#ifndef _UTILS_RES_GROUPT_MANAGER_H_
# define _UTILS_RES_GROUPT_MANAGER_H_

# include "config.h"
# include <string>
# include <vector>
# include "Utils\\AManager.h"

NS_BEGIN(SDL)
	NS_BEGIN(UTILS)

	struct Resource
	{
	public:
		std::string Name;
		std::string Path;

	public:
		Resource(std::string const& _name, std::string const& _path);
		Resource(Resource const& _resource);
		~Resource();

		Resource& operator=(Resource const& _resource);
		bool operator==(Resource const& _resource) const;
		bool operator!=(Resource const& _resource) const;
	};

	class ResGroup
	{
	private:
		std::string m_name;
		std::vector<Resource> m_resources;

	public:
		ResGroup(std::string const& _name);
	private:
		ResGroup(ResGroup const&);
	public:
		virtual ~ResGroup();

	private:
		ResGroup& operator=(ResGroup const&);
	public:
		Resource const* operator[](std::string const& _resName) const;

	public:
		bool AddResource(std::string const& _name, std::string const& _path);
		bool RemoveResource(std::string const& _name);
		void Clear();

		std::string const& GetName() const;
		std::vector<Resource> const& GetResources() const;

	public:
		__declspec(property(get=GetName)) std::string name;
		__declspec(property(get=GetResources)) std::vector<Resource> resources;
	};

	class ResGroupManager : public AManager<ResGroup>
	{
	public:
		static std::string const DEFAULT_GROUP;
	private:
		static ResGroupManager& m_instance;
		static ResGroup m_defaultGroup;

	protected:
		ResGroupManager();
	private:
		ResGroupManager(ResGroupManager const&);
	protected:
		~ResGroupManager();

	private:
		ResGroupManager& operator=(ResGroupManager const&);

	public:
		static ResGroupManager& Instance();

		virtual void Manage(IArgs* _args = NULL);
		bool AddResource(std::string const& _resName, std::string const& _path,
						 std::string const& _groupName);

		Resource const& GetResource(std::string const& _groupName,
									std::string const& _resName);
	};

	NS_END(UTILS)
NS_END(SDL)


#endif // _UTILS_RES_GROUP_MANAGER_H_
